package com.seisys.controller.system.subsys;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.seisys.common.annotation.Anoymous;
import com.seisys.controller.base.BaseController;
import com.seisys.service.system.subsys.SubSysRoleService;
import com.seisys.util.Common;
import com.seisys.util.IData;
import com.seisys.util.IDataList;
import com.seisys.util.JacksonJsonUtil;

/**
 * 
 * 〈一句话功能简述〉菜单权限，根据不同用户权限读取
 * 〈功能详细描述〉
 * @author Bowen
 * @version 2017-7-17
 * @see SubSysRoleController
 */
@Controller
@RequestMapping(value = "/subSysRole")
public class SubSysRoleController extends BaseController {

	@Autowired
	private SubSysRoleService subSysRoleService;
	
	
	/**
	 * 
	 * Description: 查询用户子系统名称
	 * 1、
	 * 2、
	 * 
	 * @return
	 * @throws Exception 
	 * @see
	 */
	@Anoymous
	@SuppressWarnings({ "rawtypes" })
	@RequestMapping("/list.do")
//	@ResponseBody
	public void list(HttpServletResponse response,HttpServletRequest request) throws Exception {
		Map<String, Object> result = new HashMap<String, Object>();
		List list = IDataList.getInstance();
		IData param = IData.getInstance(request);
		list =subSysRoleService.getSubSysRolelistbyUserID(param);
		result.put("list", list);
//		return result;
		StringBuilder msg = new StringBuilder();
		msg.append(JacksonJsonUtil.beanToJson(result));
		Common.getWriter(response, "success_getSubMenuList", msg.toString());
	}
	
	/**
	 * Description: 查询用户子系统名称
	 * @return
	 * @throws Exception 
	 */
	@Anoymous
	@SuppressWarnings({ "rawtypes" })
	@RequestMapping("/getSubMenu.do")
//	@ResponseBody
	public void getSubMenu(HttpServletResponse response,HttpServletRequest request) throws Exception {
		Map<String, Object> result = new HashMap<String, Object>();
		List list = IDataList.getInstance();
		IData param = IData.getInstance(request);
		list =subSysRoleService.getSubSysRole(param);
		result.put("list", list);
		StringBuilder msg = new StringBuilder();
		msg.append(JacksonJsonUtil.beanToJson(result));
		Common.getWriter(response, "success_getSubMenuList", msg.toString());
	}
	
}
